<template>
    <div class="project-details-infomation">

      <div class="info-container">

        <div>
<!--          <item-title title="基本信息"></item-title>-->

          <el-row>

            <el-form :inline="true" ref="elForm" :model="datas" size="small" label-width="110px">
              <el-row>
                <el-col :span="8">
                  <el-form-item label="立项信息：">
                    <a v-if="datas.demand_info_name" @click="infoClick" style="color: #286ee6">{{datas.demand_info_name}}</a>
                    <div v-else>无</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="项目来源：">
                    <div>{{datas.project_source_name ? datas.project_source_name : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="项目编号：">
                    <div>{{datas.project_no ? datas.project_no : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="项目名称：">
                    <div>{{datas.project_name ? datas.project_name : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="项目所属阶段：">
                    <div>{{datas.project_phases_name ? datas.project_phases_name : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="项目级别：">
                    <div>{{datas.project_level_name ? datas.project_level_name : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="项目类型：">
                    <div>{{datas.project_category_name ? datas.project_category_name : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="申报类别：">
                    <div>{{datas.sign_category_name ? datas.sign_category_name : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="药物成分：">
                    <div>{{datas.drug_ingredient ? datas.drug_ingredient : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="药物类别：">
                    <div>{{datas.drug_category ? datas.drug_category : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="功能主治：">
                    <div>{{datas.function_attend ? datas.function_attend : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="剂型与规格：">
                    <div>{{datas.drug_or_specifications ? datas.drug_or_specifications : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="项目负责人：">
                    <div>{{datas.project_person_in_charge ? datas.project_person_in_charge : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="委托单位：" v-if="datas.project_source_id == 2">
                    <div>{{datas.entrusting_party ? datas.entrusting_party : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="datas.status > 4 && datas.status != 32">
                  <el-form-item label="工期（天）：">
                    <div>{{datas.duration}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="datas.status > 4 && datas.status != 32">
                  <el-form-item label="计划开始时间：">
                    <div>{{datas.plan_start_time ? dateFormat1('yyyy-mm-dd',datas.plan_start_time) : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="datas.status > 4 && datas.status != 32">
                  <el-form-item label="计划结束时间：">
                    <div>{{datas.plan_end_time ? dateFormat1('yyyy-mm-dd',datas.plan_end_time) : "无"}}</div>
                  </el-form-item>
                </el-col>

                <el-col :span="8" v-if="isOther && datas.status > 4 && datas.status != 32">
                  <el-form-item label="实际开始时间：">
                    <div>{{datas.reality_start_time ? dateFormat1('yyyy-mm-dd',datas.reality_start_time) : "无"}}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="isOther && datas.status > 4 && datas.status != 32">
                  <el-form-item label="实际结束时间：">
                    <div>{{datas.reality_end_time ? dateFormat1('yyyy-mm-dd',datas.reality_end_time) : "无"}}</div>
                  </el-form-item>
                </el-col>


              </el-row>

            </el-form>

          </el-row>
        </div>


        <div style="margin-top: 20px" v-if="datas.status >1">
          <item-title title="方案书"></item-title>
          <el-row>

            <el-form ref="form" label-width="150px">

              <el-form-item label="项目技术方案书">
                <file-preview :file-list="datas.project_design_book ? datas.project_design_book.tech : []" />
              </el-form-item>

              <el-form-item label="项目预算方案书">
                <file-preview :file-list="datas.project_design_book ? datas.project_design_book.budget : []" />
              </el-form-item>

              <el-form-item label="其他">
                <file-preview :file-list="datas.project_design_book ? datas.project_design_book.other : []" />
              </el-form-item>

            </el-form>

          </el-row>
        </div>

<!--        <div style="margin: 20px 0" v-if="operationList.length && !noOperation">-->

<!--          <item-title title="操作日志"></item-title>-->

<!--          <history-view :datas="operationList" :to="{name:'projectAuditDetail'}"></history-view>-->

<!--          <pagination style="display:flex;justify-content:flex-end;" :total="total" :page.sync="pageNum"-->
<!--                      :limit.sync="pageSize" @pagination="getOperationRecords" />-->
<!--        </div>-->

        <div style="margin: 20px 0" v-if="!noOperation">
          <el-tabs v-model="activeName2">
            <el-tab-pane name="1">
              <div slot="label">
                <i style="margin-right: 5px" /><span>操作日志</span>
              </div>
              <div class="tab-content">
                <history-view :datas="operationList" :to="{name:'projectAuditDetail'}"></history-view>

                <pagination style="display:flex;justify-content:flex-end;" :total="total" :page.sync="pageNum"
                            :limit.sync="pageSize" @pagination="getOperationRecords" />
              </div>
            </el-tab-pane>
            <el-tab-pane name="2" v-if="datas.status <= 5 || datas.status == 52 || datas.status == 32">
              <div slot="label">
                <i style="margin-right: 5px" /><span>会议记录</span>
              </div>
              <div class="tab-content">
                <meeting-view :datas="meetingList"></meeting-view>

                <pagination style="display:flex;justify-content:flex-end;" :total="total1" :page.sync="pageNum1"
                            :limit.sync="pageSize1" @pagination="getMeetingData" />
              </div>
            </el-tab-pane>
          </el-tabs>
        </div>


      </div>

    </div>
</template>

<script>
  import meetingView from "./meetingView";

    export default {
        name: "informationView",
        components:{meetingView},
        props:{
            datas:{
                type:Object,
                default:function () {
                    return{

                    }
                }
            },
            noOperation:{
                type:Boolean,
                default:function () {
                    return false;
                }
            },
            isOther:{
                type:Boolean,
                default:function () {
                    return false
                }
            },
        },
        data:function () {
            return{
                activeName2:"1",
                operationList:[],
                pageNum:1,
                pageSize:10,
                total:0,
                squareUrl:'',
                pageNum1:1,
                pageSize1:10,
                total1:0,
                meetingList:[]
            }
        },
        watch:{
            datas:{
                handler(newV,oldV){

                    if (newV && newV.id && !this.noOperation){
                        this.getOperationRecords();
                        this.getMeetingData();
                    }
                },
                immediate:true,
                deep:true
            }
        },
        mounted() {

        },
        methods:{
            infoClick:function(){
                this.$router.push({
                    name: 'auditDetail',
                    query: {
                        projectId: this.datas.demand_info_id,
                    }
                })
            },
            getOperationRecords:function () {

                let data = {
                    pager:{
                        limit:this.pageSize,
                        skip:this.pageNum,
                        OrderBy:'',
                        OrderMethod:-1
                    }
                }
                this.$api.PROJECT_WORK_OPERATION_LIST(this.datas.id,data).then(res=>{
                    if (res.code == 200){
                        this.operationList = res.data.data;
                        this.total = res.data.total;
                    }else {
                        this.$message.error(res.msg);
                    }
                })
            },
            getMeetingData:function () {
                let data = {
                    meeting_type:"project",
                    relation_id:this.datas.id,
                    pager:{
                        limit:this.pageSize1,
                        skip:this.pageNum1,
                        OrderBy:'',
                        OrderMethod:-1
                    }
                }
                this.$api.PROJECT_START_PROJECT_MEETING_LIST(data).then(res=>{
                    if (res.code == 200){
                        this.meetingList = res.data.data;
                        this.total1 = res.data.total
                    }
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
  @import "@/assets/scss/views/projectManagement/list/details/information.scss";
</style>
